define(['./../initial'], function() {
    var app = angular.module('App.home');
    app.factory('symbolFactory', [
        function() {
            var symbolCollections = {
                Road: {
                    fillColor: '#748DF3',
                    weight: 2,
                    opacity: 1,
                    color: "#999",
                    fillOpacity: 0.7,
                    clickable: false
                },
                Pit: {
                    weight: 3,
                    color: "#999",
                    opacity: 1,
                    fillColor: "#B1D66E", //B1D66E
                    fillOpacity: 0.8,
                    clickable: false
                },
                Other: {
                    fillColor: '#D95C5C',
                    weight: 2,
                    opacity: 1,
                    color: '#999',
                    fillOpacity: 0.7,
                    clickable: false
                },
                Plot: {
                    fillColor: '#FFFFFF',
                    weight: 2,
                    opacity: 1,
                    color: 'transparent',
                    fillOpacity: 0.0,
                    clickable: false
                },
                Point: {
                    radius: 0,
                    fillColor: "transparent",
                    color: "transparent",
                    weight: 0,
                    opacity: 0,
                    fillOpacity: 0,
                    clickable: false
                },
                PointUp: {
                    radius: 1,
                    fillColor: "#57DBAA",
                    color: "#57DBAA",
                    weight: 1,
                    opacity: 0,
                    fillOpacity: 0.9,
                    clickable: false
                },
                PointDown: {
                    radius: 1,
                    fillColor: "#999",
                    color: "#999",
                    weight: 1,
                    opacity: 0,
                    fillOpacity: 0.9,
                    clickable: false
                },
                Default: {
                    fillColor: "#eee",
                    weight: 2,
                    opacity: 1,
                    color: 'white',
                    dashArray: '3',
                    fillOpacity: 0.7,
                    clickable: false
                },
                Factory: function(feature) {
                    var style = {
                        fillColor: '#748DF3',
                        weight: 0.4,
                        opacity: 0.8,
                        color: "#555",
                        fillOpacity: 0.8,
                        clickable: false
                    };
                    if (feature.properties.Color) {
                        if (feature.geometry.type === 'LineString' || feature.geometry.type === 'MultiLineString') {
                            style.color = feature.properties.Color;
                            style.fillColor = feature.properties.Color;
                            style.weight = 1;
                        } else {
                            style.fillColor = feature.properties.Color;
                        }
                        return style;
                    } else {
                        if (feature.geometry.type === 'Polygon' || feature.geometry.type === 'MultiPolygon') {
                            //面对象
                            var prop = feature.properties.Type;
                            return symbolCollections[prop] ? symbolCollections[prop] : symbolCollections.Default;
                        } else if (feature.geometry.type === "Point") {
                            return symbolCollections.Point;
                        } else return symbolCollections.Road;
                    }
                },
                PointFactory: function(feature) {
                    var prop = feature.properties.Location;
                    if (prop === '上行线') {
                        return symbolCollections.PointUp;
                    } else if (prop === '下行线') {
                        return symbolCollections.PointDown;
                    } else return symbolCollections.Point;
                }
            };
            return symbolCollections;
        }
    ]);
});
